//package com.hmall.gateway.filters;
//
//import org.springframework.cloud.gateway.filter.GatewayFilterChain;
//import org.springframework.cloud.gateway.filter.GlobalFilter;
//import org.springframework.core.Ordered;
//import org.springframework.http.server.reactive.ServerHttpResponse;
//import org.springframework.stereotype.Component;
//import org.springframework.web.server.ServerWebExchange;
//import reactor.core.publisher.Mono;
//
///**
// * <自定义GlobalFilter>
// *     自定义GlobalFilter则简单很多，直接实现GlobalFilter即可，而且也无法设置动态参数
// */
//@Component
//public class PrintAnyGlobalFilter implements GlobalFilter, Ordered {
//    @Override
//    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//        // 编写过滤器逻辑
//        System.out.println("未登录，无法访问");
//        // 放行
//        // return chain.filter(exchange);
//
//        // 拦截
//        ServerHttpResponse response = exchange.getResponse();
//        response.setRawStatusCode(401);
//        return response.setComplete();
//    }
//
//    @Override
//    public int getOrder() {
//        // 过滤器执行顺序，值越小，优先级越高
//        return 0;
//    }
//}